package bishi;

import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;

import java.util.Scanner;

/**
 * @Author liuhaoqi
 * @Date 2020/8/26 22:11
 * @Version 1.0
 */
public class Huawei02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        System.out.println(getMaxArea(str));
    }

    public static int getMaxArea(String str) {
        String[] split = str.replaceAll("\\]", "")
                .replaceAll("\\[", "")
                .split(",");
        int[] width = new int[split.length / 2];
        int[] height = new int[split.length / 2];
        if (split.length % 2 != 0) {
            System.out.println(0);
            return 0;
        }
        for (int i = 0; i < split.length / 2; i++) {
            width[i] = Integer.parseInt(split[i]);
            if (width[i] > 100 || width[i] < 0) {
                System.out.println(0);
                return 0;
            }
        }
        for (int i = split.length / 2; i < split.length; i++) {
            height[i - split.length / 2] = Integer.parseInt(split[i]);
            if (height[i - split.length / 2] > 100 || height[i - split.length / 2] < 0) {
                System.out.println(0);
                return 0;
            }
        }
        int maxarea = 0;
        int sum =0;
        for (int i = 0; i < width.length; i++) {
            sum = width[i]*height[i];
            for (int j = i - 1; j > 0 && height[j] >= height[i]; j--) {
                sum += width[j] * height[i];
            }
            for (int j = i + 1; j < width.length && height[j] >= height[i]; j++) {
                sum += width[j] * height[i];
            }
            maxarea = Math.max(maxarea, sum);
        }
        return maxarea;
    }
}
